<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>16-BFC解决浮动元素高度塌陷</title>
    <style>
      .container {
        background-color: orange;
        position: relative;
        /* 利用 BFC 解决浮动高度塌陷问题 */
        overflow: auto;
      }
      .item {
        float: left;
        width: 400px;
        height: 200px;
        box-sizing: border-box;
        border: 1px solid #000;
        background-color: #f00;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="item"></div>
      <div class="item"></div>
      <div class="item"></div>
      <div class="item"></div>
    </div>
  </body>
</html>
